#!/bin/bash
#石头剪刀布游戏

menu=("石头" "剪刀" "布")

echo "请输入您的选择:1.石头2.剪刀3.布"
read -p "你的选择是：" user 
computer=$((RANDOM%3 +1))
echo "电脑选择了：${menu[$computer-1]}"
if [ $user -eq $computer ];then
	echo "平局"
	elif [[ (${menu[$user-1]} == "石头" && ${menu[$computer-1]} == "剪刀") || \
		(${menu[$user-1]} == "剪刀" && ${menu[$computer-1]} == "布") || \
		(${menu[$user-1]} == "布" && ${menu[$computer-1]} == "石头") ]];then
		echo "YOU win!!"
	else
		echo "You lose!!"
fi

